/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.Fragments;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.BasicInteractions.InteractionFragment;
import edu.pku.sei.modeler.model.uml.Kernel.PackageableElement;
import edu.pku.sei.modeler.model.uml.Kernel.NamedElement;
import edu.pku.sei.modeler.model.uml.Kernel.NamedElement;
import edu.pku.sei.modeler.model.uml.Kernel.PackageImport;
import edu.pku.sei.modeler.model.uml.Kernel.ElementImport;
import edu.pku.sei.modeler.model.uml.Kernel.Constraint;

import edu.pku.sei.modeler.model.uml.BasicInteractions.InteractionFragment;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class InteractionOperand extends InteractionFragment implements IInteractionOperand {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList guard;
	
	protected MetaTypedList fragment;
	
	
	
	protected MetaTypedList importedMember;
	
	protected MetaTypedList member;
	
	protected MetaTypedList ownedMember;
	
	protected MetaTypedList packageImport;
	
	protected MetaTypedList elementImport;
	
	protected MetaTypedList ownedRule;
	
	// getters & setters for attributes
	
	// getters for references
	
	public MetaTypedList getGuard() {
		if(guard == null) {
			guard = new MetaTypedList(InteractionConstraint.class, this, ModelPackage.INTERACTIONOPERAND_GUARD);
		}
		return guard;
	}
	
	public MetaTypedList getFragment() {
		if(fragment == null) {
			fragment = new MetaTypedList(InteractionFragment.class, this, ModelPackage.INTERACTIONOPERAND_FRAGMENT);
		}
		return fragment;
	}
	
	public MetaTypedList getImportedMember() {
		if(importedMember == null) {
			importedMember = new MetaTypedList(PackageableElement.class, this, ModelPackage.NAMESPACE_IMPORTEDMEMBER);
		}
		return importedMember;
	}
	
	public MetaTypedList getMember() {
		if(member == null) {
			member = new MetaTypedList(NamedElement.class, this, ModelPackage.NAMESPACE_MEMBER);
		}
		return member;
	}
	
	public MetaTypedList getOwnedMember() {
		if(ownedMember == null) {
			ownedMember = new MetaTypedList(NamedElement.class, this, ModelPackage.NAMESPACE_OWNEDMEMBER);
		}
		return ownedMember;
	}
	
	public MetaTypedList getPackageImport() {
		if(packageImport == null) {
			packageImport = new MetaTypedList(PackageImport.class, this, ModelPackage.NAMESPACE_PACKAGEIMPORT);
		}
		return packageImport;
	}
	
	public MetaTypedList getElementImport() {
		if(elementImport == null) {
			elementImport = new MetaTypedList(ElementImport.class, this, ModelPackage.NAMESPACE_ELEMENTIMPORT);
		}
		return elementImport;
	}
	
	public MetaTypedList getOwnedRule() {
		if(ownedRule == null) {
			ownedRule = new MetaTypedList(Constraint.class, this, ModelPackage.NAMESPACE_OWNEDRULE);
		}
		return ownedRule;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INTERACTIONOPERAND_GUARD, guard);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INTERACTIONOPERAND_FRAGMENT, fragment);
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.NAMESPACE_IMPORTEDMEMBER, importedMember);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.NAMESPACE_MEMBER, member);		
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.NAMESPACE_OWNEDMEMBER, ownedMember);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.NAMESPACE_PACKAGEIMPORT, packageImport);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.NAMESPACE_ELEMENTIMPORT, elementImport);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.NAMESPACE_OWNEDRULE, ownedRule);
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getGuard().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INTERACTIONOPERAND_GUARD));
		
		this.getFragment().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INTERACTIONOPERAND_FRAGMENT));
		
		this.getImportedMember().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.NAMESPACE_IMPORTEDMEMBER, this));
		
		this.getMember().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.NAMESPACE_MEMBER, this));
		
		this.getOwnedMember().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.NAMESPACE_OWNEDMEMBER));
		
		this.getPackageImport().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.NAMESPACE_PACKAGEIMPORT));
		
		this.getElementImport().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.NAMESPACE_ELEMENTIMPORT));
		
		this.getOwnedRule().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.NAMESPACE_OWNEDRULE));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.NAMESPACE_IMPORTEDMEMBER.equals(featureID)) {
			getImportedMember().add(value);
		}
		
		else if(ModelPackage.NAMESPACE_MEMBER.equals(featureID)) {
			getMember().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 